<template>
	<view class="flex-col page">
		<view>
			<view :style="{height:statusBarHeight+'px'}"></view>
			<u-navbar title="优惠券" bgColor="#F5F5F5" @leftClick="$nav(2)">	
			</u-navbar>
		</view>
		
		<u-sticky>
			<u-tabs bar-width='70' :list="tabs" :scrollable='false'
				:current="current" @change="onChange"></u-tabs>
		</u-sticky>
			
		<!-- <view v-if="list.length > 0">
			
		</view> -->
		
		<view class="flex-col items-center" style="margin-top: 80rpx;">
			<image src="/static/data_empty.png"></image>
			<text style="color: #c0c4cc;">暂无数据</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabs:[
					{
						name:'可用'
					},
					{
						name:'不可用'
					}
				],
				current:0,
				list:[]
			};
		},
		computed:{
			statusBarHeight(){
				return this.$store.state.statusBarHeight + 44
			}
		},
		onLoad() {
			this.getCouponList();
		},
		methods:{
			
			getCouponList(){
				let cType = 0;
				if(this.current == 0){
					cType = 1;
				}else{
					cType = 2;
				}
				this.$request({
					url:'?c=User&a=couponList',
					type:'post',
					data:{
						type:cType
					}
				}).then(res =>{
					console.log(res)
				});
			},
			onChange(val){
				this.current = val.index;
				this.list = [];
				this.getCouponList();
			}
		}
	}
</script>

<style lang="scss">
.page{
	width: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	height: 100%;
}
</style>
